﻿package Classes.Elements{
	import flash.display.*;
	import flash.events.*;
	import flash.utils.*;
	
	import Classes.Utils.*;
	import Classes.*;
	import Classes.Interface.*;
	import Classes.Layers.*;
	
	public class Aero extends Element{
		public var aTargets:Array;
		public var aFriends:Array;
		//当前速度
		public var crtspeed:Number;
		//瞬时横向速度
		protected var tmpxspeed:Number;
		//瞬时纵向速度
		protected var tmpyspeed:Number;
		//加速度
		public var accelerate:Number;		
		//漂移量
		public var excursion:Number;
		//
		public var hittestable:Boolean;
		//构造函数
		public function Aero (){
			aFriends = [];
			hittestable = true;
			tmpxspeed 	= 0;
			tmpyspeed 	= 0;
			aTargets = [];
		}
		override protected function move():void{
			this.y += stagespeed;			
		}
		
		protected function hitTest():void{
			if(!hittestable)
				return;
			for(var i:int = 0;i<aTargets.length;i++){
				var t:Element = aTargets[i] as Element;
				if(HitTest.hitTestShape(this,t)){
					hittestable = false;
					hp -= t.execution;
					if(t.hurtable){
						t.hp -= this.execution;						
						if(t.hp<=0){
							hittestable = false;					
						}
					}
					if(this.hp<=0){
						killer = t;
						erasable = true;
						break
					}
				}
			}
		}
	}
}